package com.xintonghua.bussiness.adapter;

import android.app.Activity;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.xintonghua.base.adapter.BaseAdapter;
import com.xintonghua.bussiness.R;
import com.xintonghua.bussiness.bean.MemberBirthdayBean;
import com.xintonghua.bussiness.bean.WarningMemberListBean;
import com.xintonghua.bussiness.util.GlideUtils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 作者：wanxianyi
 * 时间：2018/1/11.
 * 包名：com.xintonghua.bussiness.adapter
 */

public class ClientAdapter extends BaseAdapter<WarningMemberListBean.MonthBean, ClientAdapter.ClientViewHolder> {
    Context context;

    public ClientAdapter(Activity mActivity, List<WarningMemberListBean.MonthBean> list) {
        super(mActivity, list);
        context = (Context) mActivity;
    }

    @Override
    public ClientViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.adapter_client, parent, false);
        return new ClientViewHolder(view);
    }


    @Override
    public void onBindViewHolder(ClientViewHolder holder, int position) {
        WarningMemberListBean.MonthBean bean = getList().get(position);
        GlideUtils.load(context, holder.ivHead, bean.getHead_img());
        holder.tvName.setText(bean.getNickname() + "");
        holder.tvPhone.setText(bean.getPhone() + "");

        holder.tvScore.setText(bean.getTotalScore() + "");
        holder.tvGx.setText("¥"+bean.getMoney() + "");
    }

    class ClientViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.iv_head)
        ImageView ivHead;
        @BindView(R.id.tv_name)
        TextView tvName;
        @BindView(R.id.tv_phone)
        TextView tvPhone;
        @BindView(R.id.tv_score)
        TextView tvScore;
        @BindView(R.id.tv_gx)
        TextView tvGx;

        public ClientViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
